package com.nhncorp.pleiades.protocol;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import com.nhncorp.pleiades.hadoop.Writable;
import com.nhncorp.pleiades.hadoop.WritableUtils;

public class PleiadesInfoData implements Writable{

  private String clusterId;
  private String notificationChannel;
  private String dfsRoot;
  private boolean splitBrainMode;
  private int heartbeatPort;
  private boolean eventUsingMulticast;

  public PleiadesInfoData() {
    this.clusterId = "NA";
    this.notificationChannel = "NA";
    this.dfsRoot = "NA";
    this.splitBrainMode = false;
    this.heartbeatPort = 0;
    this.eventUsingMulticast = true;
  }



  public void readFields(DataInput in) throws IOException {
    clusterId = WritableUtils.readString(in);
    notificationChannel = WritableUtils.readString(in);
    dfsRoot = WritableUtils.readString(in);
    splitBrainMode = in.readBoolean();
    heartbeatPort = in.readInt();
    eventUsingMulticast = in.readBoolean();
  }


  public void write(DataOutput out) throws IOException {
    WritableUtils.writeString(out, clusterId);
    WritableUtils.writeString(out, notificationChannel);
    WritableUtils.writeString(out, dfsRoot);
    out.writeBoolean(splitBrainMode);
    out.writeInt(heartbeatPort);
    out.writeBoolean(eventUsingMulticast);
  }


  public String getClusterId() {
    return clusterId;
  }


  public void setClusterId(String clusterId) {
    this.clusterId = clusterId;
  }
  
  public String getNotificationChannel() {
    return notificationChannel;
  }


  public void setNotificationChannel(String notificationChannel) {
    this.notificationChannel = notificationChannel;
  }


  public String getDfsRoot() {
    return dfsRoot;
  }


  public void setDfsRoot(String dfsRoot) {
    this.dfsRoot = dfsRoot;
  }


  public boolean isSplitBrainMode() {
    return splitBrainMode;
  }


  public void setSplitBrainMode(boolean splitBrainMode) {
    this.splitBrainMode = splitBrainMode;
  }

  public int getHeartbeatPort() {
    return heartbeatPort;
  }

  public void setHeartbeatPort(int port) {
    this.heartbeatPort = port;
  }

  public boolean isEventUsingMulticast() {
    return eventUsingMulticast;
  }

  public void setEventUsingMulticast(boolean eventUsingMulticast) {
    this.eventUsingMulticast = eventUsingMulticast;
  }

}
  
